# MakeBy: LiuBoyuan
from fastapi import APIRouter, Form, File, Depends, UploadFile

from Schema.GameDetailSchema import GameDetailBase, NewGame
from Service.GameDetailService import gameDetailService
from Sissson import get_sission

gamedetail = APIRouter(prefix="/gamedetail")


@gamedetail.post("/add")
def new_game(gameDetailBase: NewGame, session=Depends(get_sission) ):
    gameDetailService.newGame(gameDetailBase,session)
    return "over"

@gamedetail.post("/image")
async def new_game(token: str =Form(...), gid: int =  Form(...) , image:UploadFile  = File(...), session=Depends(get_sission) ):
    await gameDetailService.setGameImage(gid, token, image, session)
    return "over"